﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;

namespace Analysis.Code
{
    public class BaseDataPage : BasePage
    {
        public virtual void LoadData()
        {
        }

        protected void PhoneValidate(object source, ServerValidateEventArgs args)
        {
            Regex digitsOnly = new Regex(@"[^\d]");
            string value = args.Value;
            value = digitsOnly.Replace(value, "");
            
            args.IsValid = (value.Length == 10);
        }

        protected string FormatPhone(string phone)
        {
            Regex digitsOnly = new Regex(@"[^\d]");
            return digitsOnly.Replace(phone, "");
        }
    }
}